/*
 * 2005-11-17 lxm 创建。 
 */
package com.hd123.rumba.domain;

import java.util.List;

import net.sf.hibernate.HibernateException;

import com.hd123.rumba.exception.BusinessException;
import com.hd123.rumba.sql.DResultPage;
import com.hd123.rumba.sql.ResultPage;

/**
 * @author lxm
 * 
 */
public class DDomainPage extends DResultPage {

  private DDomain[] elements;

  public static DDomainPage create(ResultPage source) throws BusinessException, HibernateException {
    DDomainPage result = new DDomainPage();
    result.assignFrom(source);
    return result;
  }

  public static DDomainPage create(List source) throws BusinessException, HibernateException {
    DDomainPage result = new DDomainPage();
    result.assignFrom(source);
    return result;
  }

  public void assignFrom(List list) throws BusinessException, HibernateException {
    super.assignFrom(list);
    elements = new DDomain[list.size()];
    for (int i = 0; i < list.size(); i++) {
      DDomain d = new DDomain();
      d.assignFrom((IDomain) list.get(i));
      elements[i] = d;
    }
  }

  public DDomain[] getElements() {
    return elements;
  }

  public void setElements(DDomain[] elements) {
    this.elements = elements;
  }

}
